﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace Easy.Common
{
    public class Config
    {
        private static readonly string deskey = "EasyEasy";
        private static readonly string sqlConnString = ConfigurationManager.ConnectionStrings["SqlConnString"].ToString();
        private static readonly string adminUserId = ConfigurationManager.AppSettings["AdminUserId"];
        private static readonly string pluginPath = ConfigurationManager.AppSettings["PluginPath"];

        public static string TulingBuyCrmConnectString
        {
            get { return DES.Decrypt(Config.sqlConnString, deskey); }
        }

        public static string AdminUserId
        {
            get { return adminUserId; }
        }
        public static string PluginPath
        {
            get { return pluginPath; }
        }

        public static string GetConnectString(string name)
        {
            return DES.Decrypt(ConfigurationManager.ConnectionStrings[name].ToString(), deskey);
        }

        public static string GetAppSettingsValue(string key)
        {
            return ConfigurationManager.AppSettings[key];
        }
    }
}
